#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=8e3+11;
struct node {
	int val,id;
} a[N],b[N];
int n,m;
bool cmp(node a,node b) {
	if(a.val!=b.val) return a.val<b.val;
	else return a.id<b.id;
}
void init() {
	for(int i=1; i<=n; i++) b[i]=a[i];
	sort(b+1,b+n+1,cmp);
}
int main() {
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1; i<=n; i++) {
		scanf("%d",&a[i].val);
		a[i].id=i;
	}
	int f=0;
	for(int i=1; i<=m; i++) {
		int op;
		scanf("%d",&op);
		if(op==1) {
			int x,v;
			scanf("%d%d",&x,&v);
			a[x].val=v;
			f=0;
		} else if(op==2) {
			if(!f) init(),f=1;
			int x;
			scanf("%d",&x);
			int l=1,r=n;
			while(l<=r) {
				int mid=l+r>>1;
				if(b[mid].val>a[x].val) r=mid-1;
				else if(b[mid].val==a[x].val && b[mid].id>=a[x].id) r=mid-1;
				else l=mid+1;
			}
			printf("%d\n",l);
		}
	}
	return 0;
}
